
var util = require('../../utils/util.js');//导入实现时间获取

var app = getApp();
const db = wx.cloud.database({
  throwOnNotFound: false
})
const _ = db.command
let drawQrcode = require("../../utils/weapp-qrcode.js")
Page({
  data: {
    // text:util.formatOnlyTime(new Date()),
    
    
    text:util.formatOnlyTime(new Date()),
    
    // text:'{"price":100,"time":"20:00","hasIn":1}'
  },
  onLoad() {
    this.ewmChange()
    // console.log(this.data.text.price)
    console.log(this.data)
  },

  onShow(){
    this.setData({
      text:util.formatOnlyTime(new Date())
    })
  },
  ewmChange(){
    let size = {}
    size.w = wx.getSystemInfoSync().windowWidth / 750 * 600
    size.h = size.w
    var that = this

    drawQrcode({
      width: size.w,
      height: size.h,
      canvasId: 'myQrcode',
      // ctx: wx.createCanvasContext('myQrcode'),
      text:that.data.text,
      // v1.0.0+版本支持在二维码上绘制图片
    })
  },

  ewmText(e){
    this.setData({
      // text: {
      //   price:e.detail.value,
      //   time:this.data.text.time
      // }
      text:e.detail.value
    })
    console.log("传进来的text为：",this.data.text)
  },

  searchFn(){
    this.ewmChange()
  }
  
})